home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6288 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  36 lines

  1. Newsgroups: comp.lang.tcl,comp.lang.c,comp.lang.c++,comp.databases.sybase,comp.databases.oracle,comp.databases.informix,comp.databases.oracle
  2. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!cronkite!news
  3. From: Marco DeFreitas <mdefreitas@sikorsky.com>
  4. Subject: Re: realloc equivalent in C++
  5. Content-Type: text/plain; charset=us-ascii
  6. Message-ID: <1996Feb10.043730.10127@cronkite.res.utc.com>
  7. Sender: news@cronkite.res.utc.com
  8. Nntp-Posting-Host: iris604.asi.sikorsky.com
  9. Content-Transfer-Encoding: 7bit
  10. Organization: Sikorsky Aircraft
  11. References: <4fecgc$ar9@engr.orst.edu> <DMJ15v.13C@falcon.daytonoh.attgis.com> <4fgir1$pri@theory.tc.cornell.edu>
  12. Mime-Version: 1.0
  13. Date: Sat, 10 Feb 1996 04:37:30 GMT
  14. X-Mailer: Mozilla 1.1S (X11; I; IRIX 5.3 IP12)
  15. X-Url: news:4fgir1$pri@theory.tc.cornell.edu
  16.  
  17. hzhou@r26n05.tc.cornell.edu (Honbo Zhou) wrote:
  18. >Is there anything in C++ equvalent to realloc in C which can be used
  19. >to increase allocated memory? Can't find this even in C++ books which
  20. >talk about memory management specifically. Thanks. Honbo 
  21.  
  22. If you "malloc" in C++, you can still "realloc".  If, however, you are
  23. asking if there is a way to reallocate something that you did a "new"
  24. on, then the answer is no, unless you write your own reallocation 
  25. function for your classes.  My understanding as to why C++ does not
  26. allow a "re-new" is because you are not dealing with raw bits (like 
  27. you are with a malloc), you are dealing with live objects which have
  28. constructors associated with them.  That's all I know.
  29.  
  30. -- 
  31. Regards,
  32. Marco DeFreitas
  33. Sikorsky Aircraft
  34. Stratford, CT
  35.  
  36.